//
//  ALPALPHotRecommendsCell.m
//  AlpFM
//
//  Created by dllo on 16/1/27.
//  Copyright © 2016年 Alp. All rights reserved.
//

#import "ALPHotRecommendsCell.h"
#import "ALPHotRecommendsSecondCell.h"

@interface ALPHotRecommendsCell ()<UITableViewDataSource,UITableViewDelegate,ALPHotRecommendsSecondCellDelegate>
@property (nonatomic, strong) UITableView *myTableView;
@end

@implementation ALPHotRecommendsCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creat];
    }
    return self;
}
-(void)creat{
    self.myTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 375, 14 * 200 + 10 * 14) style:UITableViewStylePlain];
    self.myTableView.delegate = self;
    self.myTableView.dataSource = self;
    self.myTableView.scrollEnabled = NO;    //禁止滚动
    [self.contentView addSubview:self.myTableView];
    [self.myTableView registerClass:[ALPHotRecommendsSecondCell class] forCellReuseIdentifier:@"cell"];
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
        return 10;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 200;
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return _array.count;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ALPHotRecommendsSecondCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    cell.xieyiren = self;
    cell.two = _array[indexPath.section];
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];  //取消选中状态

}

-(void)sengMessageidid:(NSInteger)idid indexPath:(NSInteger)indexPath jishu:(NSInteger)jishu{
    [self.xieyiren sengMessageidid:idid indexPath:indexPath jishu:jishu];
}



-(void)setArray:(NSMutableArray *)array{
    _array = array;
    
    [self.myTableView reloadData];
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
